<template>
	<view class="com-consult-alert">
		<view v-show="regAlertShow">
			<view class="popup-info">
				<view class="tankuang1">
					<view class="uni-column">
						<view class="title"><text>取消的原因</text></view>
						<view class="nihao"><textarea style="height: 200upx; padding-left: 20upx;"
								v-model="refund_reason" placeholder="请输入" /></view>
					</view>
					<view class="bottom_button">
						<button class="left" type="default" @click.stop="cancel">取消</button>
						<button class="right" type="default" @click.stop="confirm">确认</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		cancelAudioOrder
	} from '@/api/inquiry.js';

	export default {
		name: 'consultAlert',
		props: {
			conversion_id: {
				type: String | Number,
				default: 0,
			},
			regAlertShow: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				refund_reason: '',
			}
		},
		methods: {
			
			cancel() {
				this.$emit('regClose')
			},
			confirm() {
				if(this.refund_reason == ''){
					return this.$util.Tips({
						title: '请输入原因'
					});
				}
				let postDic = {
					conversation_id:this.conversion_id,
					refund_reason:this.refund_reason,
				}
				let that = this;
				cancelAudioOrder(postDic).then(res => {
					this.$util.Tips({
						title: res.message
					});
					if(res.status == 200){
						that.$emit('regFinish')
					}
				}).catch(res => {
					this.$util.Tips({
						title: res
					});
				});
				
			},
		}
	}
</script>

<style lang="scss">
	.popup-info {
		background: rgba(0, 0, 0, 0.6);
		position: fixed;
		width: 100%;
		height: 100%;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		font-size: 30upx;
		padding: 40upx;
		// border-radius: 20upx;
		z-index: 9999;
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 999;

		.tankuang1 {
			border-radius: 10upx;
			width: 600upx;
			// height: 400upx;
			padding: 20upx 10upx 0 10upx;

			background: #ffffff;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: relative;
			z-index: 9999;

			.title {
				text-align: center;
				font-weight: bold;
				padding: 10rpx 0 25rpx;
			}

			.uni-column {
				width: 100%;
			}

			.bottom_button {
				height: 80upx;
				border-top: 1upx solid #cecece;
				// padding-top: 20upx;
				width: 100%;
				display: flex;
				justify-content: space-around;

				.left {
					border-right: 1upx solid #cecece;
				}

				.right {
					color: rgb(0, 122, 255);
				}

				button {
					height: 100%;
					font-size: 34upx;
					width: 50%;
					line-height: 80upx;
				}
			}
		}
	}
</style>
